package com.ars.common.servlet;

import com.ars.common.beans.Active.Mysubmit;
import com.ars.common.dao.FindMySubmit;
import com.ars.common.beans.User.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.TreeMap;


@WebServlet("/mySubmitServlet")
public class mySubmitServlet extends HttpServlet {
   

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        User logUser = (User) request.getSession().getAttribute("LogUser");
        String UserID = logUser.getUserID();
        System.out.println(UserID);

        TreeMap<Integer, Mysubmit> tmp = new TreeMap<Integer, Mysubmit>();

        try {
            tmp = new FindMySubmit().findsub(UserID);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        request.setAttribute("mysubmit",tmp);

        System.out.println("mySubmitTest");
        request.getRequestDispatcher("/indexFace/mySubmit.jsp").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
    }
}
